<template>
	<div class="signin" id="signin">
		<div class="sign_main">
			<h2>"到此一玩"小程序管理后台</h2>
			<div class="sign_name">
				<input type="text" placeholder="请输入账户" v-model="loginData.name" />
			</div>
			<div class="sign_pass">
				<input type="password" placeholder="请输入密码" v-model="loginData.pwd" />
			</div>
			<div class="sign_login">
				<button v-on:click="login()">登录</button>
			</div>
			
		</div>
	</div>
</template>

<script>
	export default {
		name: 'signin',
		computed: {
			
	  },
		data() {
			return {
				title: '',
				loginData:{
					name:'admin',
					pwd:'123456'
				}
			}
		}, //定义变量
		components: {
			
		}, //注册组件
		methods: { //方法都在这里
			login: function() {
				var that = this;
				this.lh_http('post', "login", this.loginData).done(function(res) {
					if(res.status) {
						that.$store.commit('logon', res.data.tbLogin)
//						console.log(that.getUser)
						that.$router.push({
							path: '/user/data'
						})
					} else {
						alert(res.data);
					}
				})
			}
		},
		mounted() {
			
		},
	}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss">
	.signin {
		width:612px;
		height:378px;
		background:#fff;
		border:#999 solid 1px;
		position: fixed;
		top:50%;
		left:50%;
		margin-top:-189px;
		margin-left:-306px;
		.sign_main{
			width:343px;
			margin:50px auto;
			h2{
				font-weight: normal;
				font-size:24px;
				text-align: center;
				margin-bottom:30px;
			}
			input{
				width:343px;
				height:43px;
				border:#ccc solid 1px;
				outline: none;
				border-radius:none;
				margin-bottom:40px;
				padding-left:10px;
			}
			button{
				width:343px;
				height:43px;
				border:0;
				border-radius:0;
				background:rgba(204,204,204,1);
				border-radius:4px;
				color:#000;
				font-size:16px;
				cursor: pointer;
			}
		}
	}
</style>